package com.demo.lino.admin;

import cn.hutool.extra.spring.EnableSpringUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import com.demo.pj.admin.device.service.DeviceService;
import org.springframework.beans.factory.InitializingBean;

/**
 * 后台管理端
 */
@SpringBootApplication
@ComponentScan("com.demo.*")
@EnableSpringUtil
@EnableScheduling
@EnableAsync
@EnableCaching
@EnableAspectJAutoProxy(exposeProxy = true)
public class AdminApplication implements InitializingBean {

  @ComponentScan("com.*")
	public static void main(String[] args) {
		SpringApplication.run(AdminApplication.class, args);
	}

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("hi");
    }

	@Autowired
  private DeviceService deviceService;

  @ApiOperation("创建")
  @PostMapping("create")
  public R<Long> create(@Valid @RequestBody CreateDeviceReq req) {
      DeviceService deviceServiceTemp = new deviceService();
      deviceService.info(req);
      deviceService.detail(req);
      return R.ok(deviceService.create(req));
  }
}
